//
//  SignRedCollectionViewCell.swift
//  TianTianBiTing
//
//  Created by Gox mac 2 on 2019/3/1.
//  Copyright © 2019 Gox_WallyDiao. All rights reserved.
//

import UIKit

class SignRedCollectionViewCell: UICollectionViewCell {
    var imageView = UIImageView.init()
    var label = UILabel.init()
    
    var model = SignInListModel()
    var modelList: SignInListModel? {
        didSet {
            guard let model = modelList else { return }
            self.model = model
            
            self.setImageView(day: self.model.day, status: self.model.signStatus)
            self.setlabel(day: self.model.day, status: self.model.signStatus)
        }
    }

    override init(frame: CGRect) {
        super.init(frame: frame)
        setUI()
    }
    
    func setUI() {
        
        self.contentView.addSubview(self.imageView)
        self.contentView.addSubview(self.label)

        self.imageView.layer.cornerRadius = 13.5
        self.imageView.layer.masksToBounds = true
        
        self.label.font = Font_Medium(13)
        self.label.textAlignment = .center
  
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
        
        
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        self.imageView.frame = FRAME_CGFloat(0, 0, 27, 27)
        self.label.frame = FRAME_CGFloat(7, 28, 13, 20)
    }
    
    func setImageView(day:Int,status:Int) {
        switch status {
        case 0:
            if day == 7 {
                self.imageView.image = IMAGE(name: "signRed_没到手多")
            } else {
                self.imageView.image = IMAGE(name: "signRed_没到手")
            }
        case 1:
            if day == 7 {
                self.imageView.image = IMAGE(name: "signRed_到手多")
            } else {
                self.imageView.image = IMAGE(name: "signRed_到手")
            }
        case 2:
            if day == 7 {
                self.imageView.image = IMAGE(name: "signRed_没到手多")
            } else {
                self.imageView.image = IMAGE(name: "signRed_没到手")
            }
        default:
            return
        }
    }
    
    func setlabel(day:Int,status:Int) {
        if status == 1 {
            self.label.textColor = RGB(204, 31, 0)
        } else {
            self.label.textColor = RGB_Same(176)
        }
        switch day {
        case 1:
            self.label.text = "一"
        case 2:
            self.label.text = "二"
        case 3:
            self.label.text = "三"
        case 4:
            self.label.text = "四"
        case 5:
            self.label.text = "五"
        case 6:
            self.label.text = "六"
        case 7:
            self.label.text = "七"
        default:
            return
        }
    }
    
}
